/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package entities;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

/**
 *
 * @author TANGQUOCTUAN
 */
@Entity
@Table(name = "BookTableDetails", catalog = "TUNGA", schema = "dbo")
@NamedQueries({
    @NamedQuery(name = "BookTableDetails.findAll", query = "SELECT b FROM BookTableDetails b"),
    @NamedQuery(name = "BookTableDetails.findByBookTableID", query = "SELECT b FROM BookTableDetails b WHERE b.bookTableDetailsPK.bookTableID = :bookTableID"),
    @NamedQuery(name = "BookTableDetails.findByTableNumber", query = "SELECT b FROM BookTableDetails b WHERE b.bookTableDetailsPK.tableNumber = :tableNumber"),
    @NamedQuery(name = "BookTableDetails.findByTotalPrice", query = "SELECT b FROM BookTableDetails b WHERE b.totalPrice = :totalPrice"),
    @NamedQuery(name = "BookTableDetails.findByReserveFee", query = "SELECT b FROM BookTableDetails b WHERE b.reserveFee = :reserveFee")})
public class BookTableDetails implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected BookTableDetailsPK bookTableDetailsPK;
    @Basic(optional = false)
    @Column(name = "TotalPrice", nullable = false, precision = 19, scale = 4)
    private BigDecimal totalPrice;
    @Basic(optional = false)
    @Column(name = "ReserveFee", nullable = false, precision = 19, scale = 4)
    private BigDecimal reserveFee;
    @JoinColumn(name = "TableNumber", referencedColumnName = "TableNumber", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private ResTable resTable;
    @JoinColumn(name = "BookTableID", referencedColumnName = "BookTableID", nullable = false, insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private BookTables bookTables;

    public BookTableDetails() {
    }

    public BookTableDetails(BookTableDetailsPK bookTableDetailsPK) {
        this.bookTableDetailsPK = bookTableDetailsPK;
    }

    public BookTableDetails(BookTableDetailsPK bookTableDetailsPK, BigDecimal totalPrice, BigDecimal reserveFee) {
        this.bookTableDetailsPK = bookTableDetailsPK;
        this.totalPrice = totalPrice;
        this.reserveFee = reserveFee;
    }

    public BookTableDetails(int bookTableID, int tableNumber) {
        this.bookTableDetailsPK = new BookTableDetailsPK(bookTableID, tableNumber);
    }

    public BookTableDetailsPK getBookTableDetailsPK() {
        return bookTableDetailsPK;
    }

    public void setBookTableDetailsPK(BookTableDetailsPK bookTableDetailsPK) {
        this.bookTableDetailsPK = bookTableDetailsPK;
    }

    public BigDecimal getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(BigDecimal totalPrice) {
        this.totalPrice = totalPrice;
    }

    public BigDecimal getReserveFee() {
        return reserveFee;
    }

    public void setReserveFee(BigDecimal reserveFee) {
        this.reserveFee = reserveFee;
    }

    public ResTable getResTable() {
        return resTable;
    }

    public void setResTable(ResTable resTable) {
        this.resTable = resTable;
    }

    public BookTables getBookTables() {
        return bookTables;
    }

    public void setBookTables(BookTables bookTables) {
        this.bookTables = bookTables;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (bookTableDetailsPK != null ? bookTableDetailsPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BookTableDetails)) {
            return false;
        }
        BookTableDetails other = (BookTableDetails) object;
        if ((this.bookTableDetailsPK == null && other.bookTableDetailsPK != null) || (this.bookTableDetailsPK != null && !this.bookTableDetailsPK.equals(other.bookTableDetailsPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.BookTableDetails[bookTableDetailsPK=" + bookTableDetailsPK + "]";
    }

}
